package com.sunzm.dynamic_rule.pojo;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;

/**
 * 完整的规则参数封装实体
 */
public class RuleParam implements Serializable {
    /**
     * 规则名称
     */
    private String ruleName;
    /**
     * 规则中的触发条件
     */
    private RuleAtomicParam triggerParam;

    /**
     * 规则中的用户画像条件
     */
    private HashMap<String, String> userProfileParam;

    /**
     * 规则中的行为次数类条件
     */
    private List<RuleAtomicParam> userActionCountParams;

    /**
     * 规则中的行为次序类条件
     */
    private List<RuleAtomicParam> userActionSequenceParams;

    /**
     * 序列模式匹配查询sql
     */
    private String actionSequenceQuerySql;

    /**
     * 用于记录查询服务所返回的序列中匹配的最大步骤号
     * 比如需要满足一次做过 A -> B -> C, 如果满足这个值就是3, 如果只满足A ,  这个值就是1
     */
    private int userActionSequenceQueriedMaxStep;

    public RuleParam() {
    }

    public RuleParam(String ruleName, RuleAtomicParam triggerParam, HashMap<String, String> userProfileParam, List<RuleAtomicParam> userActionCountParams, List<RuleAtomicParam> userActionSequenceParams) {
        this.ruleName = ruleName;
        this.triggerParam = triggerParam;
        this.userProfileParam = userProfileParam;
        this.userActionCountParams = userActionCountParams;
        this.userActionSequenceParams = userActionSequenceParams;
    }

    public RuleAtomicParam getTriggerParam() {
        return triggerParam;
    }

    public void setTriggerParam(RuleAtomicParam triggerParam) {
        this.triggerParam = triggerParam;
    }

    public HashMap<String, String> getUserProfileParam() {
        return userProfileParam;
    }

    public void setUserProfileParam(HashMap<String, String> userProfileParam) {
        this.userProfileParam = userProfileParam;
    }

    public List<RuleAtomicParam> getUserActionCountParams() {
        return userActionCountParams;
    }

    public void setUserActionCountParams(List<RuleAtomicParam> userActionCountParams) {
        this.userActionCountParams = userActionCountParams;
    }

    public List<RuleAtomicParam> getUserActionSequenceParams() {
        return userActionSequenceParams;
    }

    public void setUserActionSequenceParams(List<RuleAtomicParam> userActionSequenceParams) {
        this.userActionSequenceParams = userActionSequenceParams;
    }

    public String getRuleName() {
        return ruleName;
    }

    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
    }

    public int getUserActionSequenceQueriedMaxStep() {
        return userActionSequenceQueriedMaxStep;
    }

    public void setUserActionSequenceQueriedMaxStep(int userActionSequenceQueriedMaxStep) {
        this.userActionSequenceQueriedMaxStep = userActionSequenceQueriedMaxStep;
    }

    public String getActionSequenceQuerySql() {
        return actionSequenceQuerySql;
    }

    public void setActionSequenceQuerySql(String actionSequenceQuerySql) {
        this.actionSequenceQuerySql = actionSequenceQuerySql;
    }

    @Override
    public String toString() {
        return "RuleParam{" +
                "ruleName='" + ruleName + '\'' +
                ", triggerParam=" + triggerParam +
                ", userProfileParam=" + userProfileParam +
                ", userActionCountParams=" + userActionCountParams +
                ", userActionSequenceParams=" + userActionSequenceParams +
                ", userActionSequenceQueriedMaxStep=" + userActionSequenceQueriedMaxStep +
                '}';
    }
}
